package com.pub.exception;

import java.io.PrintStream;

public class FileException extends Exception
{
	private static final long serialVersionUID = 1L;

	private int statusCode, errorCode;
	
	private String messages;
	
	private Exception e;
	
	public FileException() 
	{
		super();
	}
	
	public FileException(String messages) 
	{
		super(messages);
		
		this.messages = messages;
	}
	
	public FileException(String messages, int statusCode) 
	{
		super(messages);
		
		this.messages 	= messages;
		this.statusCode	= statusCode;
	}
	
	public FileException(String messages, Exception e) 
	{
		super(messages);
		
		this.messages 	= messages;
		this.e			= e;
	}
	
	public FileException(String messages, Exception e, int statusCode) 
	{
		super(messages);
		
		this.messages 	= messages;
		this.e			= e;
		this.statusCode	= statusCode;
	}
	
	@Override
	public String getMessage()
	{
		return messages;
	}
	
	public Exception getStacks()
	{
		return e;
	}
	
	public int getStatusCode()
	{
		return statusCode;
	}
	
	public void setErrorCode(int errorCode)
	{
		this.errorCode = errorCode;
	}
	
	public int getErrorCode()
	{
		return errorCode;
	}
	
	@Override
	public void printStackTrace(PrintStream p)
	{
		if(e == null)
			p.print(messages);
		else
			e.printStackTrace(p);
	}
}
